//$(document).ready(function () {

//    var data = {
//        "topTotal": 10,
//        "butTotal": 20,
//        "undTotal": 40,
//        "mainTotal": 30
//    }
//    myFunction(data);

    function myFunction(data) {
        // 基于准备好的dom，初始化echarts实例
        var myChart = echarts.init(document.getElementById('a3'));
        var option = {
            // backgroundColor: '#16247f',
            backgroundColor: 'transparent',
            title: {
                subtextStyle: {
                    fontSize: 15,
                    padding: 20,
                    color: '#000'
                },
                x: 'center',
                y: '10%',
                textStyle: {
                    fontWeight: 'normal',
                    fontSize: 30,
                    color: '#0075EB'
                }
            },

            color: ['#02c0e4', '#b97ce3', '#ccda85', '#14d9a1'],
            series: [{
                name: 'cpu',
                type: 'pie',
                radius: ['40%', '60%'],
                center: ['50%', '50%'],
                silent: false,
                label: {
                    normal: {
                        formatter: '  {b}\n{c} ({d}%) ',
                    }
                },
                data: [{
                    value: data.butTotal,
                    name: '用户使用率'
                }, {
                    value: data.undTotal,
                    name: '系统使用率'
                }, {
                    value: data.mainTotal,
                    name: '当前空闲率'
                }],
                itemStyle: {
                    emphasis: {
                        shadowBlur: 10,
                        shadowOffsetX: 0,
                        shadowColor: 'rgba(0, 0, 0, 0.5)'
                    }
                }
            }]
        };
        myChart.setOption(option);
        window.onresize = function(){myChart.resize()};
    }
//});